//
//  ViewController.swift
//  1.10.Implementing Range Picker with UISlider
//
//  Created by joker on 15/7/21.
//  Copyright (c) 2015年 joker. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    var slider: UISlider!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        slider = UISlider(frame: CGRect(x: 0, y: 0, width: 200, height: 23))
        slider.center = view.center
        slider.minimumValue = 0
        slider.maximumValue = 100
        slider.value = slider.maximumValue / 2.0
        slider.addTarget(self, action: "sliderChanged:", forControlEvents: .ValueChanged)
        slider.continuous = false
        slider.setThumbImage(UIImage(named: "Normal"), forState: .Normal)
        slider.setThumbImage(UIImage(named: "Highlight"), forState: .Highlighted)
        view.addSubview(slider)
    }
    func sliderChanged(slider: UISlider) {
        println("\(slider.value)")
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

